Aside from the moral angle, and that not all politicians are sociopaths who consider invasion and mass war crimes to be an acceptable means of conducting foreign diplomacy, there are also a few more direct issues with this.
- Internal politics. War is costly to conduct, placing a strain on the economy, while also causing deaths on your own side. Most civilians don't particularly like this, especially when the goal of the war is stabbing a neighbor in the back purely to acquire some additional resources. Poland and Romania are democratic countries, and starting a war like this has a good chance of seeing the politicians who did it replaced.
- Friction with western allies. Supporting Ukraine is currently considered to be a priority among other Western governments, including the primary leaders in the EU and NATO. While the full diplomatic consequences are difficult to predict, it will likely end up with large-scale sanctions against the countries, and might even see movements start to remove them from the EU and NATO, though whether these succeed is a different question. Regardless, it will seriously isolate them from their current economic and military allies.
- Russia's response. While Russia would probably appreciate Poland and Romania getting more aligned with it, it would specifically like these countries to be under Russia's direct influence and control. Suddenly being excluded from the western club might make them very vulnerable here. What's more, Russia might also not appreciate other countries taking a bite out of the country it wanted under its own control, and seems to consider Russian territory, especially not when this might bring NATO countries with apparent aggressive intentions a lot closer to its own borders.
All in all, aside from any moral standpoints, Poland and Romania going after Ukraine would place them in direct conflict with their main allies, with economic sanctions likely doing far more damage than conquering part of Ukraine would offset, while also causing internal political issues, and leaving them vulnerable to another regional power which would be more than happy to turn them into its direct vassal states.
Far better to instead aid the country currently fighting the main threat to them, allowing them to weaken that country without expending the lives of their own citizens, while at the same time boosting their standing with their allies and getting the diplomatic credit for other benefits down the line.