The invention of dark energy and dark matter relies on human imagination.
My comment will be about "invention" as used in science. I'll go with the term "invention" and not worry about whether it is the appropriate term.
Newton "invented" a force of gravitational attraction. He was criticized for that (for introducing occult forces) by others, including Descartes. Nevertheless, it was a very useful idea and was one of the basic principles of Newtonian science. It has technically been replaced by GR (general relativity), which invented curvature of space to replace that gravitational force. However Newton's law of gravity is still widely used and is still useful.
Dalton "invented" the atom to account for the combinatorial properties observed in chemical reactions. This has since been superseded by a different conception of the atom, but the basic idea of the Dalton atom was an important part of classical physics and chemistry.
Mendel "invented" the gene, based only on combinatorial properties of observed inheritance. It has turned out to be the backbone of modern biology.
My point: inventing entities to account for evidence has been an important part of science. Sometimes the inventions work out, and sometimes they have to be later changed. But the fact that there appears to be some invention should not by itself be a reason for concern. The very names "dark matter" and "dark energy" already indicate that there is uncertainty about them.
Jesus was a liberal hippie